home *** CD-ROM | disk | FTP | other *** search
/ Chip: Hang es video / CHIP_ZENESZERKESZTO_2005.ISO / audio_3 / visual / robotfunk / setup.exe / {app} / main.dxr / Internal_208.ls < prev    next >
Encoding:
Text File  |  2003-11-19  |  690 b   |  29 lines

  1. property pTimer, pField, spriteNum, pbufferList, pAvgSize, pLastFrameRate
  2.  
  3. on beginSprite me
  4.   pAvgSize = 100
  5.   pLastFrameRate = 0
  6.   pTimer = the milliSeconds
  7.   pField = sprite(spriteNum).member.name
  8.   pbufferList = []
  9.   repeat with n = 1 to pAvgSize
  10.     add(pbufferList, n)
  11.   end repeat
  12. end
  13.  
  14. on exitFrame me
  15.   thisframe = 1000.0 / (the milliSeconds - pTimer)
  16.   add(pbufferList, thisframe)
  17.   deleteAt(pbufferList, 1)
  18.   theSum = 0
  19.   repeat with n = 1 to pAvgSize
  20.     theSum = theSum + pbufferList[n]
  21.   end repeat
  22.   avg = integer(theSum / float(pAvgSize))
  23.   if avg <> pLastFrameRate then
  24.     pLastFrameRate = avg
  25.     put string(avg) into field pField
  26.   end if
  27.   pTimer = the milliSeconds
  28. end
  29.